import request from '@/utils/request'

// 创建销售订单退单
export function createSaleOrderRefund(data) {
  return request({
    url: '/pekingfish/sale-order-refund/create',
    method: 'post',
    data: data
  })
}

// 更新销售订单退单
export function updateSaleOrderRefund(data) {
  return request({
    url: '/pekingfish/sale-order-refund/update',
    method: 'put',
    data: data
  })
}

// 删除销售订单退单
export function deleteSaleOrderRefund(id) {
  return request({
    url: '/pekingfish/sale-order-refund/delete?id=' + id,
    method: 'delete'
  })
}

// 获得销售订单退单
export function getSaleOrderRefund(id) {
  return request({
    url: '/pekingfish/sale-order-refund/get?id=' + id,
    method: 'get'
  })
}

// 获得销售订单退单分页
export function getSaleOrderRefundPage(query) {
  return request({
    url: '/pekingfish/sale-order-refund/page',
    method: 'get',
    params: query
  })
}

// 获得销售订单退单分页
export function saleOrderRetunPage(query) {
  return request({
    url: '/pekingfish/sale-order-refund/saleOrderRetunPage',
    method: 'get',
    params: query
  })
}

// 导出销售订单退单 Excel
export function exportSaleOrderRefundExcel(query) {
  return request({
    url: '/pekingfish/sale-order-refund/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}


export function refundGoods(id,trackingNumber) {
  const data = {
    id,
    trackingNumber
  }
  return request({
    url: '/pekingfish/sale-order-refund/refundGoods',
    method: 'put',
    data: data
  })
}
